package xixirupan.tmgp.tencent.com.vmeim.ui.discover.model;

import android.util.Log;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import xixirupan.tmgp.tencent.com.vmeim.config.URLConfig;
import xixirupan.tmgp.tencent.com.vmeim.retrofit.IDiscoverR;

/**
 * Created by lenovo on 2016/10/21.
 */

public class DiscoverBiz {
  IDiscoverData iDiscoverData;
    public void getDataDiscover(final IDiscoverData iDiscoverData)
    {
        this.iDiscoverData =iDiscoverData;
        Retrofit retrofit =new Retrofit.Builder()
                .baseUrl(URLConfig.Url.BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        IDiscoverR iDiscoverR = retrofit.create(IDiscoverR.class);
        Call<DiscoverBean> call = iDiscoverR.discoverData();
        call.enqueue(new Callback<DiscoverBean>() {
            @Override
            public void onResponse(Call<DiscoverBean> call, Response<DiscoverBean> response)
            {
                               DiscoverBean body = response.body();
                DataBaen data = body.getData();
                List<BlocksBaen> blocks = data.getBlocks();

                List<BannersBaen> banners = data.getBanners();//轮滑
                String url =blocks.get(0).getData().get(0).getImgURL();//美妆视频
             //   String imgURL = blocks.get(0).getData2().get(0).getImgURL();//达人
              //  iDiscoverData.post(url+";;;;;"+imgURL);


            }

            @Override
            public void onFailure(Call<DiscoverBean> call, Throwable t) {
                Log.i("发现栏目的数据请求","====>失败原因"+t.getMessage());
            }
        });
    }
}
